package org.easy.http.client.resolver;

import javafx.util.Builder;
import org.easy.http.client.util.ArrayUtils;
import org.easy.http.client.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @Description TODO
 * @Author WuXueLi
 * @Date 16:11 2023/2/4
 * @Version 1.0
 **/
public class EasyPlaceholderPropertyResolver implements EasyPropertyResolver{

    private final Logger LOGGER = LoggerFactory.getLogger(EasyPlaceholderPropertyResolver.class);

    private static final String PLACEHOLDER_PREFIX = "${";

    private Map<String,String> propertyStringValue;

    private EasyPlaceholderPropertyResolver (Builder builder) {
        this.processFile(builder.pathEntries);
    }

    private void processFile(List<String> pathEntries) {

    }

    @Override
    public boolean containsProperty(String key) {
        return false;
    }

    @Override
    public Map<String, String> getAllProperties() {
        return null;
    }

    @Override
    public String getProperty(String key) {
        return null;
    }

    @Override
    public String getProperty(String key, String defaultValue) {
        return null;
    }

    @Override
    public <T> T getProperty(String key, Class<T> targetType) {
        return null;
    }

    @Override
    public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
        return null;
    }

    @Override
    public String resolvePlaceholders(String text) {
        return null;
    }

    public static class Builder {
        private List<String> pathEntries;

        public Builder () {
            this.pathEntries = new ArrayList<>(10);
        }

        public Builder path (String path) {
            if (StringUtils.hasLength(path)) {
                pathEntries.add(path);
            }
            return this;
        }

        public Builder pathList (String... paths) {
            if (!ArrayUtils.isEmpty(paths)) {
                pathEntries.addAll(Arrays.asList(paths));
            }
            return this;
        }

        public EasyPlaceholderPropertyResolver builder () {
            return new EasyPlaceholderPropertyResolver(this);
        }

    }


}
